#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import time
from engine.common import *
if sys.platform == "darwin":
    adbpath = "adb "
else:
    adbpath = "/usr/bin/adb "
if (sys.argv.__len__())<4:
    print( "参数个数少了")
    exit(0)
handset = sys.argv[1]
currentHandsetSnumber = sys.argv[2]
command = sys.argv[3]
areaPara = sys.argv[4]

resultF = sys.argv[5]

desc= sys.argv[6]



setHandsetSno(currentHandsetSnumber)
setHandsetType(handset)



baseDir = "/data/wwwroot/test.dianxi.com/"




def delThisImage(filePath ,resultF,desc,handset,currentHandsetSnumber,delay=0):

    


    print("restltF="+resultF)

    cmd = "cp  "+baseDir+"/"+filePath+"/*.txt "+getHandsetFileSavePath(desc)
    os.system(cmd)




    with open(getHandsetFileSavePath(resultF))as f:

        fileName =f.read()

    print("del file "+" rm "+baseDir+"/"+filePath+"/"+fileName)
    os.system(" rm "+baseDir+"/"+filePath+"/"+fileName)
    time.sleep(delay)

    with open(getHandsetFileSavePath(resultF), 'w')as f:
        if  1:
            f.write('True')
            return True  # TRUE 状态转移




if command == "delThisImage".strip():
    delThisImage(areaPara,resultF,desc , handset, currentHandsetSnumber)
